package com.guslegend.Class01_ioc;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @author: guslegend
 * @description: 测试bean生命周期
 * @create: 2025-04-27 11:45
 **/
public class MyBeanPostProcessor implements BeanPostProcessor {

    public Object postProcessBeforeInitialization(Object bean,String beanName)throws BeansException{
        System.out.println("MyBeanPostProcessor.postProcessBeforeInitialization");
        System.out.println("bean = " + bean + ", beanName = " + beanName);
        return bean;
    }

    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("MyBeanPostProcessor.postProcessAfterInitialization");
        System.out.println("bean = " + bean + ", beanName = " + beanName);
        return bean;
    }

    private void init() {
    }

    private void destroy() {
    }
}
